package com.jishuo.nontax.web;

import com.jishuo.base.annotation.UserAuthority;
import com.jishuo.base.bean.BaseResult;
import com.jishuo.base.bean.GridResult;
import com.jishuo.base.bean.Pagination;
import com.jishuo.nontax.bean.vo.BackpaybillVO;
import com.jishuo.nontax.bean.vo.StatDataVO;
import com.jishuo.nontax.bfc.service.StatDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @auther dinggaofei
 * @Date 2023/3/20 16:53
 */
@Slf4j
@Controller
@RequestMapping(value = "/bill/statdata")
@UserAuthority(menu = {"bill/statdata/index"})
public class StatController {

    @Resource
    private StatDataService statDataService;

    private String prefix = "bill/";

    @RequestMapping(value = {"statdata", "statdata/{page}"}, name = "区划月度分析页面")
    public String index(@PathVariable(required = false) String page) {
        return prefix + ((page == null) ? "statdata" : page);
    }

    @RequestMapping(value = {"serviceindex", "serviceindex/{page}"}, name = "区划月度分析页面")
    public String serviceindex(@PathVariable(required = false) String page) {
        return prefix + ((page == null) ? "serviceindex" : page);
    }

    @RequestMapping(value = {"statdataservice", "statdataservice/{page}"}, name = "业务类型月度分析")
    public String statdataservice(@PathVariable(required = false) String page) {
        return prefix + ((page == null) ? "statdataservice" : page);
    }

    /**
     * @author hlp
     * @date 2023/3/22 16:51
     * @Description: 区划月度分析列表
     */
    @ResponseBody
    @RequestMapping(value = "findStatDataPage", name = "区划月度分析列表")
    public GridResult<StatDataVO> findStatDataPage(StatDataVO statDataVO , Pagination pagination) {
        return new GridResult<>(statDataService.findStatDataPage(statDataVO.getCantonid(),statDataVO.getPaybankdt(),pagination));
    }

    /**
     * @author hlp
     * @date 2023/3/22 16:51
     * @Description: 获取月度分析
     */
    @ResponseBody
    @RequestMapping(value = "getStatData", name = "获取月度分析")
    public BaseResult getStatData(StatDataVO statDataVO) {
        return statDataService.getStatData(statDataVO.getCantonid(),statDataVO.getPaybankdt());
    }

    /**
     * @author hlp
     * @date 2023/3/23 09:30
     * @Description: 业务类型月度分析列表
     */
    @ResponseBody
    @RequestMapping(value = "findStatDataTwoPage", name = "业务类型月度分析列表")
    public GridResult<StatDataVO> findStatDataTwoPage(StatDataVO statDataVO , Pagination pagination) {
        return new GridResult<>(statDataService.findStatDataTwoPage(statDataVO.getCantonid(),statDataVO.getPaybankdt(),pagination));
    }

    /**
     * @author hlp
     * @date 2023/3/22 16:51
     * @Description: 获取业务类型月度分析
     */
    @ResponseBody
    @RequestMapping(value = "getStatData1", name = "获取业务类型月度分析")
    public BaseResult getStatData1(StatDataVO statDataVO) {
        return statDataService.getStatData1(statDataVO.getCantonid(),statDataVO.getPaybankdt());
    }

}
